class Solution(object):
    def findFarmland(self, land):
        m = len(land)
        n = len(land[0])
        out = []
        for i in range(m):
            for j in range(n):
                if land[i][j]:
                    l = j
                    h = i
                    while l < n and land[i][l] == 1:
                        l += 1
                    while h < m and land[h][j] == 1:
                        h += 1
                    out.append([i, j, h - 1, l - 1])
                    for t1 in range(i, h):
                        for t2 in range(j, l):
                            land[t1][t2] = 0
        return out